package com.example.monit.controller;

import com.example.monit.bean.ClickBehavior;
import com.example.monit.bean.ResponseRust;
import com.example.monit.service.ClickBehaviorService;
import com.example.monit.vo.ClickBehaviorVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.io.IOException;
import java.util.List;

@RestController
@RequestMapping("/behaviors")
public class ClickBehaviorController {

    @Autowired
    ClickBehaviorService clickbehaviorService;

    /**
     * 点击行为数据上传
     */
    @PostMapping("/clickbehaviors")
    public ResponseRust clickBehaviorLoad(@RequestBody List<ClickBehavior> clickBehavior) throws IOException {
        return this.clickbehaviorService.upLoadClickBehavior(clickBehavior);
    }

    /**
     * 点击行为数据查询
     */
    @GetMapping("/clickbehaviors")
    public ResponseRust getClickBehavior(ClickBehaviorVo clickbehaviorVo) throws IOException {
        return this.clickbehaviorService.queryClickBehavior(clickbehaviorVo);
    }

}
